﻿Public Class stored_functions_mitglied
    Private _db As hc_databaseDataContext
    Private _alternativstring As String

    Public Function GibAlleKundenkontakteDesMitglieds(ByVal id As Integer)

        Dim var = From it In _db.Mitglieder_Anwaerter_Kundenkontakts _
                  Where it.Mitgliede_AnwaerterID = id _
                    Select it.Kundenkontakt


        Return var



    End Function
    Public Function stringInVorundNachnameZerlegen(ByVal strtext As String) As ArrayList


        Dim strTeile As ArrayList = New ArrayList

        Dim intLetzte As Integer = 0
        Dim j As Integer = 0

        For i = 0 To strtext.Length - 1
            If strtext.Substring(i, 1) = "_" Then

                strTeile.Add(strtext.Substring(intLetzte, i - intLetzte))
                Dim test As String = strTeile(0)
                strTeile.Add(strtext.Substring(i - intLetzte + 1, (strtext.Length - test.Length) - 1))
                j += 1
                intLetzte = i + 1
            End If
        Next

        Return strTeile
    End Function

    Public Function vonMitgliedzuROISumDauer(ByVal id As Integer)
        Try
            Dim var = ((From it In _db.Projekts _
                        Select it.Angebots).Last).ToList

            Return var(0).angebotenePT
        Catch
            Return _alternativstring
        End Try


    End Function

    Public Function PTinStudenformat(ByVal pt As String) ' pt in stunden umwandeln

        Return Double.Parse(pt) * 8
    End Function

    Public Sub New()
        _db = New hc_databaseDataContext

        _alternativstring = "TBC"
    End Sub

    
End Class
